<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title商品属性添加</title>
<style>
	.table.tr.td{
		
	}
</style>
<link rel="stylesheet" href="{{ asset('admin_style/css/pintuer.css') }}">
   <link rel="stylesheet" href="{{ asset('admin_style/css/admin.css') }}">
    <script src="{{asset('admin_style/js/jquery.js')}}"></script>
    <script src="{{asset('admin_style/js/pintuer.js')}}"></script>
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong><span class="icon-reorder"></span>商品属性名</strong></div>
  <div class="border-b border-bno clearfix">
			      <a href="{{ url('goods/attr_cate_do')}}" class="button bg-yellow button-small"><span class="icon-plus"></span>添加商品属性</a>
			     </div>
  <div class="body-content" style="padding: 20px;">
	  <div class="field">
  		<select class="input" name="" id="select">
  			<option value="">请选择分类</option>
  			@foreach($cate as $v)
				<option value="{{$v->cate_id}}">{{$v->cate_name}}</option>
  			@endforeach
  		</select>
		</div>
  </div>
  <div class="attr"></div>
  <div class="content">
  	<table border='1' width="500" align="center" class="table"></table>
  </div>
</div>
</body>
</html>
<script>
//根据获取到分类id查询出来这个分类id对应的属性
		$('#select').change(function (){
			var sel = $(this).val();
			$('table').empty();
			$.ajax({
				url : "{{ url('goods/attrname/')}}/"+sel,
				type:'get',
				contentType:false,//设置编码
	            processData:false,
	            dataType: "json",
	            success:function(msg){
            		$('.attr').append('');
	            	$('.attr').empty();
	            	$(msg).each(function(index,item){
	            		$('table').append('<tr ><td>'+item['id']+'</td><td>'+item['attr_name']+'</td><td><a href="attrname_do/'+item['id']+'">添加商品属性值</a>  <b>  //  </b> <a href="attr_val/'+item['id']+'" >查看属性列表</a>  <b>  //  </b> <a href="javascript:void(0)" onclick="del('+item['id']+')">删除属性</a></td></tr>');
	            	});	
	            }
			});
		});
function del(id){
	if(confirm("您确定要删除这个属性名吗？")){
		location.href="{{ url('goods/attrName_del')}}/"+id;
	}
}
</script>